//
//  InformationTableViewCell.m
//  Youhuiju
//
//  Created by liuovyue on 16/7/25.
//  Copyright © 2016年 yutenys. All rights reserved.
//

#import "InformationTableViewCell.h"
#import "LogeInViewController.h"
#import "SearchViewController.h"
#import "SetUpController.h"
@interface InformationTableViewCell()


@property (strong, nonatomic) IBOutlet UIButton *buttonIntegral;//积分

@property (strong, nonatomic) IBOutlet UIButton *buttonReceipt;//收货地址

@property (strong, nonatomic) IBOutlet UIButton *buttonSetUp;

@property (strong, nonatomic) IBOutlet UIImageView *imageGrade;

@property (strong, nonatomic) IBOutlet UIButton *buttonNews;



//登录头像

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *headTop;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *headLedad;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *headWidth;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *headHeight;

//账号名字
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *nameTop;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *nameLead;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *nameHeight;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *nameTrail;
//等级
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *gradeHeight;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *gradeTop;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *gradeLead;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *gradeWidth;
//收货地址
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *receivedTop;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *receivedLead;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *receivedBot;
//收货地址旁边的按钮
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *receivedFuhaoWidth;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *receivedFuhaoHeight;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *receivedFuhaoLead;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *receivedFuhaoTop;
//设置
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *setUpLead;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *setUpTop;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *setUpWidth;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *setUpHeight;
//消息
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *newsTop;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *newsWidth;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *newsHeight;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *newsLead;

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *newsTrail;
//积分
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *sdfsds;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *integralHeight;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *intregalLead;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *intregalTrail;
@property (strong, nonatomic) IBOutlet UIView *viewBackground;

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *viewTrail;

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *viewTop;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imageTop;

@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imageLead;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *iimageWidth;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imageHeight;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *nameTTop;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imagebackgroundTrail;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imagegroundLead;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imagegroundBot;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imageBackgroundTop;
@property (strong, nonatomic) IBOutlet NSLayoutConstraint *imageBackgroundHeight;



@end



@implementation InformationTableViewCell





- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
//    self.viewTop.constant = -8*FitH;
//    self.viewTrail.constant = -8*FitH;
    
    
    self.buttonReceipt.alpha = 0;
    self.imageGrade.alpha = 0;
    //背景颜色
   // self.imagegroundBot.constant = -10*FitH;
    self.imageBackgroundTop.constant = -10*FitH;
    self.imagebackgroundTrail.constant = -10*FitW;
    self.imagegroundLead.constant = -10*FitW;
    self.imageBackgroundHeight.constant = 144*FitH;
    
    self.imageTop.constant = 41*FitH;
    self.imageLead.constant = 7*FitW;
    self.imageHeight.constant =88*FitH;
    self.iimageWidth.constant = 88*FitW;
    
    
    //渐变色背景
    CAGradientLayer *gradientLayer = [CAGradientLayer layer];
    gradientLayer.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 164*FitH);
    
    gradientLayer.colors = @[(id)[UIColor colorWithHexString:@"#fd487f"].CGColor,
                             (id)[UIColor colorWithHexString:@"#ff9a64"].CGColor];
    
    gradientLayer.startPoint = CGPointMake(0, 1);
    gradientLayer.endPoint = CGPointMake(1, 0);
    
    
    [self.viewBackground.layer addSublayer:gradientLayer];
    
    
    self.nameTTop.constant = 77*FitH;
    
    
    
    [self.buttonIntegral setImage:[UIImage imageNamed:@"p-jifen"] forState:UIControlStateNormal];
    
    
    [self.buttonSetUp setImage:[UIImage imageNamed:@"ljzshezhii"] forState:UIControlStateNormal];
    //消息按钮
    [self.buttonNews setImage:[UIImage imageNamed:@"information"] forState:UIControlStateNormal];
    
    //头像视频适配
    self.headTop.constant = 49*FitH;
    self.headLedad.constant = 7*FitW;
    self.headWidth.constant = 88*FitW;
    self.headHeight.constant = 88*FitH;
    
    //账号名字适配
    self.nameTop.constant = 84*FitH;
    self.nameLead.constant = 10*FitW;
    self.nameTrail.constant = 71*FitW;
    self.nameHeight.constant = 19*FitH;
    
    //等级适配
    self.gradeTop.constant =11*FitH;
    self.gradeLead.constant =11*FitW;
    self.gradeWidth.constant = 70*FitW;
    self.gradeHeight.constant = 15*FitH;
    
    //收货地址
    
    self.receivedBot.constant = 28*FitH;
    self.receivedTop.constant = 19*FitH;
    self.receivedLead.constant = 44*FitW;
    
    
    //收货地址旁边的符号
//    self.receivedFuhaoTop.constant = 19*FitH;
//    self.receivedFuhaoLead.constant = 13*FitW;
//    self.receivedFuhaoWidth.constant = 18*FitW;
//    self.receivedFuhaoHeight.constant = 18*FitH;
    
    
    //积分按钮
    self.intregalLead.constant = 309*FitW;
    self.sdfsds.constant = 123*FitH;
    self.intregalTrail.constant = 0;
    self.integralHeight.constant = 24*FitH;
    
    
    //设置
    self.setUpTop.constant = 5*FitH;
    self.setUpLead.constant = 281*FitW;
    self.setUpWidth.constant = 25*FitW;
    self.setUpHeight.constant = 24*FitH;
    
    //消息
    self.newsTop.constant = 5*FitH;
    //self.newsLead.constant = 30*FitW;
    self.newsWidth.constant = 25*FitW;
    self.newsHeight.constant = 24*FitH;
    self.newsTrail.constant = 7*FitW;
    
  
    self.buttonIntegral.alpha = 0;
    
   
}
//点击跳转登录界面
- (IBAction)buttonLogeIn:(id)sender {
    
    id object = [self nextResponder];
    while (![object isKindOfClass:[UIViewController class]]&& object != nil) {
        
        object = [object nextResponder];
        
        
    }
    UIViewController *vc = (UIViewController *)object;
    
//    LogeInViewController *logein = [[LogeInViewController alloc]initWithNibName:@"LogeInViewController" bundle:nil];
    
     LogeInViewController*svc = [[LogeInViewController alloc]initWithNibName:@"LogeInViewController" bundle:nil];
    
    [vc.navigationController pushViewController:svc animated:YES];
    
    
    
    
}
- (IBAction)setUpAction:(id)sender {
    
    id object = [self nextResponder];
    while (![object isKindOfClass:[UIViewController class]]&&object!=nil) {
        object = [object nextResponder];
    }
    
    UIViewController *vc = (UIViewController *)object;
    SetUpController *setup = [[SetUpController alloc]init];
    [vc.navigationController pushViewController:setup animated:YES];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
